﻿using CatUtils.Utils.Currency.IoUtils;

using CatUtils.Utils.SpecialUtils.View;
using CatUtilsDll.Utils.Currency.WebUtils;
using RabbitDownload.WebSite.Pixiv.Login;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace RabbitDownload.WebSite.Pixiv.PixivDic
{
    public partial class PixivDicControl : UserControl
    {
        public PixivDicControl()
        {
            InitializeComponent();
            new PixivDicHelper().InitCombobox(comboBox1);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            new PixivDicHelper().InitScanner(comboBox1.Text, textboxOnlyCount2.Text, textboxOnlyCount3.Text, textboxOnlyCount1.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            CWebclient cWebclient = new LoginHelper().AutoLogin();
            if (cWebclient == null)
            {
                MessageHelper.Alert("初始化登录失败！");
                return;
            }

            new PixivDicTranslate().TranslateFile(FileHelper.SelectFile(), cWebclient);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            CWebclient cWebclient = new LoginHelper().AutoLogin();
            if (cWebclient == null)
            {
                MessageHelper.Alert("初始化登录失败！");
                return;
            }
            new PixivDicTranslate().TranslateFloder(FloderHelper.SelectFloder(), cWebclient);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            List<string> FileList = FileHelper.SelectMultiFile();
            label6.Text = string.Format("已加载{0}个词库。", FileList.Count);
            new PixivDicTranslate().HandleLexicon(FileList);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            new PixivDicHelper().ScannerAll(textboxOnlyCount4.Text);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            new PixivDicHelper().ScannerAll(500 + "");
        }
    }
}